package com.smaato.logging;

import java.io.PrintStream;
import net.rim.device.api.system.EventLogger;
import net.rim.device.api.util.StringUtilities;

public class Log {
	private static final Object syncObject = new Object();
	private static final String EVENT_LOGGER_NAME = "SmaatoAdExample";
	private static final long EVENT_LOGGER_GUID = StringUtilities.stringHashToLong("SmaatoAdExample");

	static {
		EventLogger.register(EVENT_LOGGER_GUID, "SmaatoAdExample", 2);
	}

	public static void exception(Exception e, String string) {
		writeLog(e.toString() + " while " + string);
	}

	public static void debug(String string) {
		writeLog(string);
	}

	private static void writeLog(String string) {
		synchronized (syncObject) {
			System.out.println("SmaatoAdExample LOG: " + string);
			EventLogger.logEvent(EVENT_LOGGER_GUID, string.getBytes(), 0);
		}
	}
}